package com.liycloud.mall.order.controller;

import com.liycloud.common.core.util.ResultVo;
import com.liycloud.common.web.controller.BaseController;
import com.liycloud.mall.api.entity.OrderEntity;
import com.liycloud.mall.order.service.OrderService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order")
@AllArgsConstructor
public class OrderController extends BaseController<OrderService, OrderEntity> {


	private final OrderService orderService;

	/**
	 *  通过用户ID  查询该用户所有订单order
	 */
	@GetMapping("/getOrderByUserId/{userId}")
	ResultVo<List<OrderEntity>> getOrderByUserId(@PathVariable("userId") Integer userId){
		List<OrderEntity> orderByUserId = orderService.getOrderByUserId(userId);
		return ResultVo.ok(orderByUserId,"用户订单查询成功");
	}



}
